import React from 'react';
import { Button, message } from 'antd';
import ProForm, {
  ModalForm,
  ProFormText,
  ProFormDateRangePicker,
  ProFormSelect,
  ProFormUploadDragger,
  ProFormUploadButton,
} from '@ant-design/pro-form';
import { PlusOutlined, FileAddOutlined } from '@ant-design/icons';
import DownLoadFile from '@/components/DownLoadFile';
const waitTime = (time: number = 100) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(true);
    }, time);
  });
};

export default () => {
  return (
    <ModalForm<{
      name: string;
      company: string;
    }>
      title="导入数据"
      trigger={
        <Button type="primary">
          <FileAddOutlined />
          导入数据
        </Button>
      }
      autoFocusFirstInput
      modalProps={{
        destroyOnClose: true,
        onCancel: () => console.log('run'),
      }}
      onFinish={async (values) => {
        await waitTime(2000);
        console.log(values.name);
        message.success('提交成功');
        return true;
      }}
    >
      <ProForm.Group>
        <DownLoadFile />
      </ProForm.Group>
      <ProForm.Group>
        <ProFormUploadDragger max={4} label="上传所需文件" name="dragger" />
      </ProForm.Group>
    </ModalForm>
  );
};
